<?php
class model_guide extends model_weixin{
	
	/**
	 * @info 新增选材指导记录
	 * @author jackie yang
	 * @datetime 20140705
	 * @param  $data  array
	 */
	public static function add_guide_recode($data) {
		$sql = "INSERT INTO `weixin_select_guid` SET ";
		$binds = array ();
		foreach ( $data as $k => $v ) {
			$sql .= '`' . $k . '`=:' . $k . ',';
			$binds [':' . $k] = $v;
		}
		$sql .= 'raw_add_time=NOW(),raw_update_time=now()';
		try {
			$arr = self::DB ()->dbh->prepare ( $sql );
			$rel = $arr->execute ( $binds );
			if ($rel == TRUE) {
				return self::DB ()->dbh->lastInsertId ();
			}
		} catch ( Exception $e ) {
			framework_static_function::write_log ( __METHOD__ . ":" . $e->getMessage (), 'weixin_sql' );
		}
		return 0;
	}	
}